﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Bussiness.Service;
using Bussiness;


namespace KiwiShopping.Controllers
{
    [HandleError]
    public class ProductsController : BaseController
    {
        //
        // GET: /Products/

        public ActionResult DanhSachSanPham(int ID_Catelogy, int PageIndex)
        {
            string path = Server.MapPath("/Addmin/BackEnd/images/small");
            List<Product> list = new Product_Service().get_PRODUCTS_By_idCatelogy_Paging(ID_Catelogy, PageIndex, path);
            List<int> listPage = new Product_Service().get_List_Page_Product(ID_Catelogy,12);
            ViewData["ListProducs"] = list;
            ViewData["ListPage"] = listPage;
            ViewData["Catelogy"] = new Catelogy_Service().getCatelogy(ID_Catelogy);

            return View();
        }

        //public ActionResult DanhSachSanPham(int ID_Catelogy, int PageIndex)
        //{
        //    string path = Server.MapPath("/Addmin/BackEnd/images/small");
        //    List<Product> list = new Product_Service().get_PRODUCTS_By_idCatelogy_Paging(ID_Catelogy, PageIndex, path);
        //    List<int> listPage = new Product_Service().get_List_Page_Product(ID_Catelogy, 12);
        //    ViewData["ListProducs"] = list;
        //    ViewData["ListPage"] = listPage;
        //    ViewData["Catelogy"] = new Catelogy_Service().getCatelogy(ID_Catelogy);

        //    return View();
        //}

        public ActionResult ChiTietSanPham(int ID)
        {
           string path = Server.MapPath("/Addmin/BackEnd/images/small");
           string path2 = Server.MapPath("/Addmin/BackEnd/images/large");
            ViewData["ProductDetail"] = new Product_Service().getProductByID2(ID, path, path2);
            ViewData["ListImage"] = new Product_Service().getListImageByProductID(ID, path);
            ViewData["ListSize"] = new Product_Service().getListSizeByProductID(ID);
           return View();
        }


        //public ActionResult ChiTietSanPham()
        //{
        //    return View();
        //}
    }
}
